import Vue from 'vue'
import App from './App'
import store from './store/index.js'
import './style/thorui.css'
const { devUrl,serverUrlSocket,serverUrl,devUrlSocket } = require('./api/config.js');
Vue.config.productionTip = false

App.mpType = 'app'

import VueSocketIO from 'vue-socket.io'
Vue.use(new VueSocketIO({
	debug:true,
	connection:serverUrlSocket,
	vuex:{}
}));

const SEA = require('./utils/zy-ende.js');

Vue.prototype.$sea = SEA;

// 引入部分组件
import tuiBadge from '@/components/thorui/tui-badge/tui-badge.vue';
Vue.component("tui-badge",tuiBadge);

import tuiList from '@/components/thorui/tui-list-cell/tui-list-cell.vue';
Vue.component("tui-list-cell",tuiList);

import tuiIcon from '@/components/thorui/tui-icon/tui-icon.vue';
Vue.component("tui-icon",tuiIcon);

import tuiButton from '@/components/thorui/tui-button/tui-button.vue';
Vue.component("tui-button",tuiButton);

import tuiBotPop from '@/components/thorui/tui-bottom-popup/tui-bottom-popup.vue';
Vue.component("tui-bottom-popup",tuiBotPop);

import tuiListV from '@/components/thorui/tui-list-view/tui-list-view.vue';
Vue.component("tui-list-view",tuiListV);

import tuiTag from '@/components/thorui/tui-tag/tui-tag.vue';
Vue.component("tui-tag",tuiTag);

import tuiModal from '@/components/thorui/tui-modal/tui-modal.vue';
Vue.component("tui-modal",tuiModal);

import tuiNomore from '@/components/thorui/tui-nomore/tui-nomore.vue';
Vue.component('tui-nomore',tuiNomore);

import tuiCard from '@/components/thorui/tui-card/tui-card.vue';
Vue.component('tui-card',tuiCard);

// import tuiModal from '@/components/thorui/tui-modal/tui-modal.vue'
// Vue.component("tui-modal",tuiModal);

import public_api from 'api/public.js';
Vue.prototype.api = {
	public:public_api
}
Vue.prototype.url = serverUrl;


Vue.prototype.tui = {
	toast: function(text, duration, success) {
		uni.showToast({
			title: text || "出错啦~",
			icon: success ? 'success' : 'none',
			duration: duration || 2000
		})
	},
	modal: function(title, content, showCancel, callback, confirmColor, confirmText) {
		uni.showModal({
			title: title || '提示',
			content: content,
			showCancel: showCancel,
			cancelColor: "#555",
			confirmColor: confirmColor || "#5677fc",
			confirmText: confirmText || "确定",
			success(res) {
				if (res.confirm) {
					callback && callback(true)
				} else {
					callback && callback(false)
				}
			}
		})
	},
}

const app = new Vue({
    ...App,
	store
})
app.$mount()
